<?php

use Illuminate\Http\Request;

Route::middleware('auth:api')->get('/user', function (Request $request) {
    return $request->user();
});


Route::post('login','AuthController@login');//登录
Route::get ('logout','AuthController@logout');//退出

//公众号登录(浏览器插件操作不需要登录)
Route::post('token','MainController@token');//获取数据库对应账号的token
Route::get ('scan', 'MainController@scan');//获取微信二维码
Route::post('check','MainController@check');//验证二维码扫描状态,成功则换取token和cookie并保存数据库


Route::group(['middleware' => 'auth:api'],function(){
    //上传
    Route::post('upload','IndexController@upload');//文件上传



    //公众号配置
    Route::group(['prefix' => 'wechat'], function(){
        Route::get ('all','WechatController@all');//所有公号
        Route::get ('info','WechatController@info');//公号详情
        Route::post('update','WechatController@update');//公号更新
    });

    //公众号管理
    Route::group(['prefix' => 'account'], function(){
        Route::get   ('/','ManageController@index');//公号列表
        Route::delete('destory','ManageController@destory');//公号删除
    });

    //用户管理
    Route::group(['prefix' => 'user'], function(){
        Route::get   ('/','UserController@index');//用户管理
        Route::get   ('info','UserController@info');//用户信息
        Route::delete('destory','UserController@destory');//公号删除
        Route::post  ('update','UserController@update');//用户更新
    });

    //角色管理
    Route::group(['prefix' => 'role'], function(){
        Route::get   ('/','RoleController@index');//角色列表
        Route::post  ('update','RoleController@update');//角色更新
        Route::delete('destory','RoleController@destory');//角色删除
    });

    //系统配置
    Route::group(['prefix' => 'setting'], function(){
        Route::get ('/','SettingController@index');//系统配置
        Route::post('update','SettingController@update');//系统配置更新
    });

    //敏感词库
    Route::group(['prefix' => 'illegal'], function(){
        Route::get   ('/','IllegalController@index');//敏感词库
        Route::post  ('update','IllegalController@update');//敏感词更新
        Route::delete('destory','IllegalController@destory');//敏感词删除
    });





});
//列表：index;更新：update；删除：destory；详情：info；激活：active；锁定：lock；所有;all；


//微信小程序-活动抽奖
Route::group(['prefix' => 'activity','namespace'=>'Applet'], function(){
    Route::get   ('/','ActivityController@index');//首页列表
    Route::get   ('info','ActivityController@info');//活动详情
    Route::post  ('update','ActivityController@activityUpdate');//发起活动
});
//微信小程序-活动抽奖-用户信息
Route::group(['prefix' => 'activity_user','namespace'=>'Applet'], function(){
    Route::get   ('/','ActivityUserController@index');//用户个人信息
    Route::get   ('info','ActivityUserController@info');//参与用户列表
    Route::post  ('active','ActivityUserController@active');//参与用户列表
});
//微信小程序-活动抽奖-用户地址信息
Route::group(['prefix' => 'activity_address','namespace'=>'Applet'], function(){
    Route::get   ('/','ActivityAddressController@index');//个人地址信息
    Route::post  ('update','ActivityAddressController@update');//更新用户地址
});